//
//  StaicShow_Cell.m
//  penzer
//
//  Created by caiyc on 2018/10/5.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "StaicShow_Cell.h"

@implementation StaicShow_Cell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentViews.layer.cornerRadius = 8;
    self.contentViews.layer.masksToBounds = 1;
    self.live_type.layer.cornerRadius = 11;
    self.live_type.layer.masksToBounds = 1;
    self.checkdetailLab.layer.cornerRadius = 10;
    self.checkdetailLab.layer.masksToBounds = 1;
    self.check_rule_Btn.layer.cornerRadius = 12;
    self.check_rule_Btn.layer.masksToBounds = 1;
    self.sale_type.layer.cornerRadius = 11;
    self.sale_type.layer.masksToBounds = 1;
    self.time_botom_View1.layer.cornerRadius = 15;
    self.time_botom_View1.layer.masksToBounds = 1;
    self.time_bottom_View2.layer.cornerRadius = 15;
    self.time_bottom_View2.layer.masksToBounds = 1;
    
    self.hostIcon.layer.cornerRadius = 15;
    self.hostIcon.layer.masksToBounds = 1;
    self.storeIcon.layer.cornerRadius = 10;
    self.storeIcon.layer.masksToBounds = 1;
     NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle],NSForegroundColorAttributeName:[UIColor whiteColor]};
     NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:[self.old_Price.text substringWithRange: NSMakeRange(0, self.old_Price.text.length)] attributes:attribtDic];
    self.old_Price.attributedText = attribtStr;
    
    // Initialization code
}
-(void)bindData:(NSDictionary *)dic{
    NSDictionary *goods = dic[@"goods_list"][0];
    NSDictionary *hostInfo = dic[@"anchor_list"][0];
    NSURL *goodUrl = [NSURL URLWithString:goods[@"thumb"]];
    [self.images sd_setImageWithURL:goodUrl];
    self.title.text = goods[@"title"];
    NSString *oldStr =  [NSString stringWithFormat:@"市场价%@",goods[@"price"]];
    NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle],NSForegroundColorAttributeName:[UIColor whiteColor]};
    NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:[oldStr substringWithRange: NSMakeRange(0, oldStr.length)] attributes:attribtDic];
    self.old_Price.attributedText = attribtStr;
   // self.oldPrice.text = [NSString stringWithFormat:@"市场价%@",goods[@"price"]];
    self.storename.text = dic[@"title"];
    self.room.text = [NSString stringWithFormat:@"房间：%@",dic[@"room_number"]];
    NSURL *iconUrl = [NSURL URLWithString:hostInfo[@"avatar"]];
    [self.hostIcon sd_setImageWithURL:iconUrl placeholderImage:[UIImage imageNamed:@"logo"]];
    self.hostNick.text = hostInfo[@"nickname"];
    NSURL *stroeIcon = [NSURL URLWithString:dic[@"logo"]];
    [self.storeIcon sd_setImageWithURL:stroeIcon placeholderImage:[UIImage imageNamed:@"logo"]];
    self.price.text = [NSString stringWithFormat:@"¥%@元",goods[@"buy_price"]];
    self.live_type.text = dic[@"live_type_cn"];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
